﻿// Extensions Made Easy - Copyright 2012 by Jan Van der Haegen - All rights reserved, use for educational purposes only.

using System.ComponentModel.Composition;
using Microsoft.LightSwitch.Theming;

namespace ExtensionsMadeEasy.ClientAPI.Theme
{
    [InheritedExport(typeof(IThemeExporter))]
    public abstract class EasyThemeExporter<T>
    : IThemeExporter
        where T : ITheme, new ()
    {
        private T theme;

        public Microsoft.LightSwitch.Theming.ITheme GetTheme()
        {
            return this.theme == null ? (this.theme = new T()) : this.theme; 
        }
    }
}